//
//  WFRepeatImageCollectionViewCell.m
//  FAKER
//
//  Created by Jianwei on 15/11/3.
//  Copyright © 2015年 YHLai. All rights reserved.
//

#import "WFRepeatImageCollectionViewCell.h"
#import "FitHeader.h"
#import "AllHeader.h"

@implementation WFRepeatImageCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self createItem];
    }
    return self;
}

- (void)createItem
{
    _promotion_imageView = [[UIImageView alloc]init];
    [CONTENT_VIEW addSubview:_promotion_imageView];
    
    _image_urlImageView = [[UIImageView alloc]init];
    [CONTENT_VIEW addSubview:_image_urlImageView];
    
    _titleLabel = [[UILabel alloc]init];
    _titleLabel.font = [UIFont fontWithBold:1 IPhone6sPlus:16 Iphone6s:15 Iphone5s:14 Iphone4s:13];
    _titleLabel.textColor = [UIColor whiteColor];
    _titleLabel.shadowColor = [UIColor blackColor];
    _titleLabel.highlighted = YES;
    _titleLabel.shadowOffset = CGSizeMake(-.1, .7);
    [CONTENT_VIEW addSubview:_titleLabel];
}
- (void)setRepeatImageModel:(WFRepeatImageModel *)repeatImageModel
{
    _repeatImageModel = repeatImageModel;
    
    [_promotion_imageView sd_setImageWithURL:[NSURL URLWithString:_repeatImageModel.promotion_img] placeholderImage:[UIImage imageNamed:@" "]];
    
    [_image_urlImageView sd_setImageWithURL:[NSURL URLWithString:[_repeatImageModel.tag_info objectForKey:@"image_url"]]];
    
    _titleLabel.text = _repeatImageModel.title;
}
- (void)layoutSubviews
{
    [super layoutSubviews];
    _promotion_imageView.frame = self.contentView.frame;
    
    _image_urlImageView.frame = CGRectMake(352 * FITWIDTH, 13 * FITHEIGHT, 23 * FITWIDTH, 13 * FITHEIGHT);
    
    _titleLabel.frame = CGRectMake(20 * FITWIDTH, 180 * FITHEIGHT, _promotion_imageView.WIDTH, 26 * FITHEIGHT);
    
    
    
}
@end
